package com.zheng.study.company.service;

import com.zheng.study.base.bean.BaseEnumManager;
import com.zheng.study.base.bean.Result;
import com.zheng.study.base.service.BaseService;
import com.zheng.study.company.entity.Admin;
import com.zheng.study.company.entity.User;

import javax.servlet.http.HttpServletRequest;

/**
 * newFile
 * ============================================================================
 * author : dzw
 * createDate:  2018/8/16 。
 * ============================================================================
 */
public interface AdminService extends BaseService<Admin, String> {

	/**
	 * 创建用户
	 */
	Admin createAdmin(BaseEnumManager.AccountEnum accountEnum, BaseEnumManager.AccountTypeEnum accountTypeEnum, String account, String password, Integer isEnabled);

	/**
	 * 通过登录账号查找admin
	 */
	Admin getAdminByAccount(String account);

	/**
	 * 通过openId获取admin
	 */
	Admin getAdminByOpenId(String openId);

	/**
	 * 修改openId
	 */
	Result updateOpenId(Admin admin, String openId);

	/**
	 * 获取一个用户的登录账号
	 */
	String getAccount(Admin admin);
	String getAccount(User user);

	/**
	 * 更新登陆信息
	 */
	void updateLoginInfo(Admin admin, HttpServletRequest request);

	/**
	 * 更新用户名
	 */
	Result updateUsername(Admin admin, String newUsername);

	/**
	 * 更新手机号
	 */
	Result updateUserMobile(Admin admin, String newUserMobile);

	/**
	 * 更新邮箱
	 */
	Result updateUserEmail(Admin admin, String newUserEmail);

	/**
	 * 验证密码是否正确
	 */
	boolean validPassword(Admin admin, String password);

	/**
	 * 修改密码
	 */
	Result updatePassword(Admin admin, String newPassword);
}
